import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import curPath from 'path'

const svgPath = path => {
    return curPath.resolve(process.cwd(), 'src/assets/', path)
}

export default function createSvgIcon(isBuild) {
    return createSvgIconsPlugin({
        iconDirs: [
            svgPath('icons/svg/loading'),
            svgPath('icons/svg')
        ],
        symbolId: 'icon-[dir]-[name]',
        svgoOptions: isBuild
    })
}
